<template>
	<view class="homeBox">
		<view class="nav">
			<view class="homenav">
				<!-- <view class="homenavL">
					<image class="dibiao" src="@/static/img/addr.png" mode="widthFix" @click="openAddr" />
					全国
				</view> -->
				<view class="homenavR">
					<i class="iconfont icon-sousuo homenavRSousuo" />
					<input class="swiper1" type="text" />
				</view>
			</view>
			<view class="homenavSelect">
				<uniPicker ref="uniPicker" v-model="paramObj.areaId" @p="pBtn" />
				<uniPicker ref="uniPicker1" v-model="paramObj.genreId" @p="pBtn1" />
				<uniPicker ref="uniPicker2" v-model="paramObj.sortValue" @p="pBtn2" />
			</view>
		</view>
		<view class="home-box" style="margin-top: 200rpx;">
			<!-- 商品列表 -->
			<view class="shop-list">
				<view v-for="(item, index) in shopList" :key="index" class="shop-item">
					<!-- 商品图片 -->
					<image :src="item.image" mode="aspectFill" class="shop-image"></image>
					<!-- 商品信息 -->
					<view class="shop-info">
						<!-- 标题 -->
						<text class="shop-title">{{ item.title }}</text>
						<!-- 名字 -->
						<text class="shop-name">{{ item.name }}</text>
						<!-- 时间 -->
						<text class="shop-time">时间：{{ item.time }}</text>
						<view class="shop-info-bottom">
							<!-- 地点 -->
							<text class="shop-location">地点：{{ item.location }}</text>
							<!-- 价格 -->
							<text class="shop-price"><text class="price-icon">￥</text> {{ item.price }}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		<addressBox ref="addressBox" @addrFun="addrFun" />
	</view>
</template>

<script>
	import {
		mapGetters
	} from 'vuex'
	import addressBox from '@/components/cityPicker/addressBox.vue'
	import uniPicker from '@/components/uni_picker/uni_picker.vue'
	export default {
		name: 'uni_home',
		components: {
			addressBox,
			uniPicker,
		},
		data() {
			return {
				imgUrl: this.$apiFun.imgUrl,
				host: this.$apiFun.host,
				NewsList: [], //输入框轮播文案
				// 输入框轮播
				indicatorDots1: false,
				autoplay1: true,
				vertical1: true,
				interval1: 5000,
				duration1: 1000,
				circular1: true,
				shopList: [{
						image: 'https://qcloud.dpfile.com/pc/_22NoSoft3aE6EJvPPVKZl7azJnSbjQvlobQc1TprekID0bsu-SAtCe9N8iBmkY3.jpg',
						title: '济南 张蔷2025「香草橙柿 一路繁花」LIVE巡演济南站济南 张蔷2025「香草橙柿 一路繁花」LIVE巡演济南站',
						time: '2023-10-01 14:00',
						name: '周杰伦',
						location: '北京',
						price: '99.99'
					},
					{
						image: 'https://qcloud.dpfile.com/pc/kDGPxk7sSy-IMWjRxmVIHmd0uS8A9nsAJlUIyucibgyztIovP0BrKDTdf2ycVz5i.jpg',
						title: '济南|李宗盛2025「有歌之年』巡回演唱会-济南站2',
						time: '2023-10-02 15:00',
						name: '大双',
						location: '上海',
						price: '89.99'
					},
					{
						image: 'https://qcloud.dpfile.com/pc/_22NoSoft3aE6EJvPPVKZl7azJnSbjQvlobQc1TprekID0bsu-SAtCe9N8iBmkY3.jpg',
						title: '济南|音乐剧《寻找李二狗》3',
						time: '2023-10-03 16:00',
						name: '二双',
						location: '广州',
						price: '79.99'
					},
					{
						image: 'https://qcloud.dpfile.com/pc/kDGPxk7sSy-IMWjRxmVIHmd0uS8A9nsAJlUIyucibgyztIovP0BrKDTdf2ycVz5i.jpg',
						title: '商品标题4',
						time: '2023-10-04 17:00',
						name: '小沈阳',
						location: '深圳',
						price: '69.99'
					},
					{
						image: 'https://qcloud.dpfile.com/pc/kDGPxk7sSy-IMWjRxmVIHmd0uS8A9nsAJlUIyucibgyztIovP0BrKDTdf2ycVz5i.jpg',
						title: '商品标题4',
						time: '2023-10-04 17:00',
						name: '林俊杰',
						location: '深圳',
						price: '69.99'
					},
					{
						image: 'https://qcloud.dpfile.com/pc/kDGPxk7sSy-IMWjRxmVIHmd0uS8A9nsAJlUIyucibgyztIovP0BrKDTdf2ycVz5i.jpg',
						title: '商品标题4',
						time: '2023-10-04 17:00',
						name: '周杰伦',
						location: '深圳',
						price: '69.99'
					}
				],
				paramObj: {
					addr: ''
				},
			}
		},
		watch: {},
		computed: {
			//login_status 0 未登录 、1临时微信登录 2已登录
			...mapGetters([
				'login_status',

			]),

		},
		async onLoad(option) {
			this.init()
		},
		mounted() {
			this.setPicker()
		},
		methods: {
			setPicker() {
				const goldenArea = [{
					name: '综合排序',
					id: 0
				}, {
					name: '最新优先',
					id: 1
				}, {
					name: '低价有限',
					id: 2
				}, {
					name: '好评优先',
					id: 3
				}]
				const timeArr = [{
					name: '全部时间',
					id: 0
				}, {
					name: '一周内',
					id: 1
				}, {
					name: '一月内',
					id: 2
				}, {
					name: '本周末',
					id: 3
				}]
				this.$nextTick(() => {
					this.$refs['uniPicker'].changeShow({
						array: goldenArea,
						id: 0,
					})
					this.$refs['uniPicker1'].changeShow({
						array: timeArr,
						id: 0,
					})
					this.$refs['uniPicker2'].changeShow({
						array: goldenArea,
						id: 3,
					})
				})
			},
			async init() {
				let res = await this.$apiFun.getApi(this.$api.menuListApi)
				console.log('res', res)
			},
			openAddr() {
				this.$refs['addressBox'].open()
			},
			addrFun(val) {
				console.log('val---------', val)
			}
		},
		onReachBottom() {
			console.log(1111111111111)
		},
		onPullDownRefresh() {},
	}
</script>

<style scoped lang="less">
	page {
		width: 100%;
		height: 100%;
		background: #f2f2fa;
		color: #6c6c6c;

		.homeBox {
			width: 100%;
			height: 100%;
		}

		.home-box {
			padding: 0 15rpx;
			box-sizing: border-box;

		}

		.nav {
			position: fixed;
			left: 0;
			right: 0;
			top: 0;
			height: 180rpx;
			z-index: 1;
		}

		.homenav {
			height: 100rpx;
			width: 100%;
			padding: 0 30rpx;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			background: #ffffff;
			z-index: 1;

			.homenavL {
				display: flex;
				align-items: center;
				min-width: 120rpx;
				font-size: 28rpx;

				.dibiao {
					width: 45rpx;
					height: 30rpx;
					margin-right: 10rpx;
					color: #fd8585;
				}

			}

			.homenavR {
				display: flex;
				align-items: center;
				width: 100%;
				// padding: 0 0 0 10rpx;
				box-sizing: border-box;
				position: relative;
				flex: 1;

				.homenavRSousuo {
					position: absolute;
					z-index: 1;
					color: white;
					left: 30rpx;
					color: #8243da;
				}

				.swiper1 {
					width: 100%;
					height: 60rpx;
					// background-color: rgba(0, 0, 0, .1);
					border: 1rpx solid #8243da;
					margin: 0 auto;
					border-radius: 60rpx;
					padding: 0 50rpx 0 80rpx;
					box-sizing: border-box;
					font-size: 24rpx;
					color: #333333;
					line-height: 60rpx;
					width: 100%;
					overflow: hidden;

					.swiper1View {
						white-space: nowrap;
					}
				}
			}

			.qiandao {
				width: 50rpx;
				height: 50rpx;
				margin-left: 20rpx;
			}
		}

		.homenavSelect {
			display: flex;
			align-items: center;
			justify-content: space-around;
			text-align: center;
			background-color: white;
			height: 80rpx;

			.homenavSelectImg {
				width: 35rpx;
				height: 30rpx;
				margin-left: 10rpx;
			}
		}

		/* 商品列表 */
		.shop-list {
			margin-top: 15rpx;
			display: flex;
			flex-direction: column;

			/* 竖向排列 */
			/* 单个商品项 */
			.shop-item {
				display: flex;
				align-items: center;
				padding: 30rpx 20rpx;
				box-sizing: border-box;
				margin-bottom: 20rpx;
				background-color: #fff;
				border-radius: 10rpx;
				overflow: hidden;
				box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1);
			}

			/* 商品图片 */
			.shop-image {
				border-radius: 10rpx;
				width: 140rpx;
				height: 200rpx;
			}

			/* 商品信息 */
			.shop-info {
				flex: 1;
				padding: 0;
				margin-left: 20rpx;
			}

			/* 商品标题 */
			.shop-title {
				font-size: 27rpx;
				color: #333;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				/* 限制文本显示为2行 */
				-webkit-box-orient: vertical;
				/* 垂直排列盒子 */
				overflow: hidden;
				/* 隐藏超出部分 */
				text-overflow: ellipsis;
				/* 显示省略号 */
				margin-bottom: 10rpx;
			}

			.shop-name {
				display: block;
				font-size: 28rpx;
				color: #ffbe86;
				margin-bottom: 5rpx;

			}

			.shop-time {
				display: block;
				font-size: 28rpx;
				color: #666;
				margin-bottom: 5rpx;
			}

			.shop-info-bottom {
				display: flex;
				align-items: center;
				justify-content: space-between;

				/* 商品地点 */
				.shop-location {
					display: block;
					font-size: 28rpx;
					color: #666;
					margin-bottom: 10rpx;
				}

				/* 商品价格 */
				.shop-price {
					display: block;
					font-size: 30rpx;
					color: #f87fa8;
					font-weight: bold;

					.price-icon {
						font-size: 18rpx;
					}
				}
			}
		}





	}
</style>